package com.financing.wap.dto;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.Date;

import com.financing.wap.util.DateUtil;
/**
 * 会员信息表
 * @author huqiyun
 *
 */
public class DstMemberInfoDTO extends BaseDTO  {

	 private String userOpenid;//用户openid
	 private Double memberLevel;//会员等级
	 private Integer memberDuration;//会员时长
	 private Date memberStartDate;//会员开通时间
	 private Date memberEndDate;//会员截止时间
	 private String memberCharge;//是否收费会员1是2否
	 private BigDecimal memberMoney;//用户当前佣金余额
	 private BigDecimal memberAllMoney;//用户总佣金
	 private BigDecimal memberWithdraw;//用户已提现佣金
	 private Integer memberScore;//会员总积分
	 private Integer memberUseScore;//会员使用积分
	
	 private String memberStartDateFormat;
	 private String memberEndDateFormat;
	 //会员是否过期
	 private Boolean flagMemberExpire;
	 //过期多少天
	 private Integer memberExpireDate;
	 //会员当前积分
	 private Integer memberCurrentScore;
	
	 public void setUserOpenid(String userOpenid) {
        this.userOpenid = userOpenid == null ? null : userOpenid.trim();
     }
	 public String getUserOpenid(){
         return userOpenid;
     }
   	 public void setMemberLevel(Double memberLevel) {
        this.memberLevel = memberLevel == null ? null : memberLevel;
     }
	 public Double getMemberLevel(){
         return memberLevel;
     }
   	 public void setMemberDuration(Integer memberDuration) {
        this.memberDuration = memberDuration == null ? null : memberDuration;
     }
	 public Integer getMemberDuration(){
         return memberDuration;
     }
   	 public void setMemberStartDate(Date memberStartDate) {
        this.memberStartDate = memberStartDate == null ? null : memberStartDate;
     }
	 public Date getMemberStartDate(){
         return memberStartDate;
     }
   	 public void setMemberEndDate(Date memberEndDate) {
        this.memberEndDate = memberEndDate == null ? null : memberEndDate;
     }
	 public Date getMemberEndDate(){
         return memberEndDate;
     }
	 public void setMemberCharge(String memberCharge) {
        this.memberCharge = memberCharge == null ? null : memberCharge.trim();
     }
	 public String getMemberCharge(){
         return memberCharge;
     }
   	 public BigDecimal getMemberMoney() {
		return memberMoney;
	}
	public void setMemberMoney(BigDecimal memberMoney) {
		this.memberMoney = memberMoney;
	}
	public BigDecimal getMemberAllMoney() {
		return memberAllMoney;
	}
	public void setMemberAllMoney(BigDecimal memberAllMoney) {
		this.memberAllMoney = memberAllMoney;
	}
	public BigDecimal getMemberWithdraw() {
		return memberWithdraw;
	}
	public void setMemberWithdraw(BigDecimal memberWithdraw) {
		this.memberWithdraw = memberWithdraw;
	}
	public void setMemberScore(Integer memberScore) {
        this.memberScore = memberScore == null ? null : memberScore;
     }
	 public Integer getMemberScore(){
         return memberScore;
     }
   	 public void setMemberUseScore(Integer memberUseScore) {
        this.memberUseScore = memberUseScore == null ? 0 : memberUseScore;
     }
	 public Integer getMemberUseScore(){
         return memberUseScore;
     }
	public String getMemberStartDateFormat() {
		if(this.memberStartDate==null)return "";
		return DateUtil.formatDate(this.memberStartDate, "yyyy-MM-dd");
	}
	public void setMemberStartDateFormat(String memberStartDateFormat) {
		this.memberStartDateFormat = memberStartDateFormat;
	}
	public String getMemberEndDateFormat() {
		if(this.memberEndDate==null)return "";
		return DateUtil.formatDate(this.memberEndDate, "yyyy-MM-dd");
	}
	public void setMemberEndDateFormat(String memberEndDateFormat) {
		this.memberEndDateFormat = memberEndDateFormat;
	}
	
	public Boolean getFlagMemberExpire() {
		if(this.memberEndDate==null)return true;
		return new Date().after(this.memberEndDate);
	}
	public void setFlagMemberExpire(Boolean flagMemberExpire) {
		this.flagMemberExpire = flagMemberExpire;
	}
	public Integer getMemberExpireDate() {
		if(this.memberEndDate==null)return 0;
		try {
			return (int) DateUtil.dateDiff(DateUtil.formatDate(this.memberEndDate,"yyyyMMdd"), DateUtil.formatDate(new Date(),"yyyyMMdd"))+1;
		} catch (ParseException e) {
			return 0;
		}
	}
	public void setMemberExpireDate(Integer memberExpireDate) {
		this.memberExpireDate = memberExpireDate;
	}

	public Integer getMemberCurrentScore() {
		Integer memberScore = (getMemberScore()== null ? 0:getMemberScore());
		Integer memberUseScore = (getMemberUseScore()== null ? 0:getMemberUseScore());
		return memberScore - memberUseScore;
	}

	public void setMemberCurrentScore(Integer memberCurrentScore) {
		this.memberCurrentScore = memberCurrentScore;
	}
}